#!/usr/bin/env sh

build() {
    rm -rf     build
    mkdir      build
    cd         build
    cmake      ..
    cp         compile_commands.json ..
    make

    # Printout the size of output binary file.
    cd ..
    fileSize=$(du -kh bin/ChatServer | cut -f1)
    printf "total size: %s\n" $fileSize
}

clean() {
    rm -rf build
    rm -rf bin
    rm -r  compile_commands.json
}

set -e

case $1 in
    "clean")
        clean
        ;;
    "build")
        build
        ;;
    "help" | *)
        ;;
esac
